<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('教务班级列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>班级名：</label>
                            <input type="text" name="className"/>
                        </li>
                        <li>
                            <label>上课时间：</label>
                            <input type="text" class="time-input" placeholder="请选择上课时间" name="teachTime"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('teaching:classes:edit')}]];
    var removeFlag = [[${@permission.hasPermi('teaching:classes:remove')}]];
    var prefix = ctx + "teaching/classes";
    var class_status = [[${@dict.getType('sys_classes_status')}]];

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            modalName: "教务班级",
            columns: [{
                checkbox: true
            },
                {
                    field: 'classId',
                    title: '主键ID',
                    visible: false
                },
                {
                    field: 'className',
                    title: '班级名称',
                    formatter: function (value, row, index) {
                        return '<a href="javascript:void(0)">' + value + '</a>';
                    }
                },
                {
                    field: 'teacherName',
                    title: '班主任'
                },
                {
                    field: 'courseName',
                    title: '课程',
                    visible: false
                },
                {
                    field: 'schoolName',
                    title: '所属校区',
                    visible: false
                },
                // {
                //     field: 'classStudent',
                //     title: '在读人数'
                // },
                {
                    // field: 'maxStudent',
                    title: '人数',
                    formatter: function (value, row, index) {
                        return row.classStudent + '/' + row.maxStudent;
                    }
                },
                // {
                //     field: 'classroomName',
                //     title: '教室'
                // },
                {
                    field: 'teachTime',
                    title: '上课时间'
                },
                {
                    field: 'status',
                    title: '招生状态',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(class_status, value);
                    }
                }]
        };
        $.table.init(options);
    });

    /* 添加用户-选择用户-提交(回调形式-父页面调用子页面) */
    function getSelections(index) {
        return $.table.selectColumns(index, false);
        // return $.table.selectFirstColumns();
    }

    /* 添加班级-选择班级-提交 */
    function submitHandler() {
        console.log("test");
        // var rows = $.table.selectFirstColumns();
        // console.log(rows);
        // if (rows.length == 0) {
        //     $.modal.alertWarning("请至少选择一条记录");
        //     return;
        // }
        // alert(rows.join());
    }
</script>
</body>
</html>
